from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from app01.views import Psychologist,Police,Student,Camera
from app01.views.Student import StudentViewSet,StudentViewSet_Psychologist_add,StudentViewSet_classname,StudentBehaviorAPIView   # 确保这里正确导入
# 创建路由器实例
router = routers.DefaultRouter()    #
tea_add_stu_router = routers.DefaultRouter() #
tea_class_router = routers.DefaultRouter()
class_stu_router = routers.DefaultRouter()
stu_show_royter = routers.DefaultRouter()


# 注册视图集到路由器
router.register(r'xybl/stu_list', StudentViewSet, basename='student')   #教师的学生列表
tea_add_stu_router.register(r'xybl/Psychologist/stu_add', StudentViewSet_Psychologist_add, basename='Psychologist_add_stu')
tea_class_router.register(r'xybl/Psychologist/classroom_list', Psychologist.Psychologist_classroom_list, basename='Psychologist_classroom_list')
class_stu_router.register(r'xybl/Psychologist/class_stu', StudentViewSet_classname, basename='Psychologist_class_stu')
stu_show_royter.register(r'xybl/Student_show', Student.Student_show, basename='Student_show')

urlpatterns = [
    path('',include(stu_show_royter.urls)),   # 学生信息展示
    path('', include(router.urls)),         #教师的学生列表
    path('', include(tea_add_stu_router.urls)),  # 教师添加学生
    path('', include(tea_class_router.urls)),  # 教师班级列表
    path('',include(class_stu_router.urls)),    # 教师班级学生列表
    path("xybl/Psychologist_add/", Psychologist.Psychologist_add), # 心理辅导员注册
    path("xybl/Police_add",Police.Police_add), # 警察注册
    path("xybl/Psychologist_or_Police_login/", Psychologist.Psychologist_login),  # 心理辅导员或警察登录
    # path("xybl/Psychologist/classroom_list",Psychologist.Psychologist_classroom_list),  # 心理辅导员班级列表
    path("xybl/Psychologist/classroom_add",Psychologist.Psychologist_classroom_add),  # 心理辅导员添加班级
    path("xybl/Student_add",Student.Student_add),  # 学生注册
    path("xybl/Psychologist/Student_delete",Psychologist.Student_delete),  # 心理辅导员删除学生
    path("xybl/logout",Psychologist.logout),  # 退出登录
    path("xybl/Student/emotion_and_behavior_add",StudentBehaviorAPIView.as_view(), name='add_behavior'),
    path('xybl/camera/add_or_updata/', Camera.camera_add_or_updata, name='camera_add_or_updata'),  #摄像头获取url
    path('xybl/camera/show/', Camera.CameraListView.as_view(), name='camera_list'), #摄像头返回给请前端
    path('xybl/camera/record_event/', Camera.record_event, name='record_event'),
    path('xybl/camera_events/', Camera.CameraEventListView.as_view(), name='camera-event-list'),
    path('xybl/stu_bug_model/', Student.Student_bug_model, name='stu_bug_model'),
    
]
 